package com.jumi.microservice.controller.jd;

import com.jumi.microservice.common.base.dto.ResponseResult;
import com.jumi.microservice.common.page.TableDataInfo;
import com.jumi.microservice.dto.jd.category.JdCategoryRequest;
import com.jumi.microservice.dto.jd.category.JdCategoryResponse;
import com.jumi.microservice.dto.jd.details.JdBigFieldGoodsResponse;
import com.jumi.microservice.dto.jd.details.JdGoodsDetailsRequest;
import com.jumi.microservice.dto.jd.keywordquery.JdKeywordQueryRequest;
import com.jumi.microservice.dto.jd.promote.JdPromoteRequest;
import com.jumi.microservice.dto.jd.promote.JdPromoteResponse;
import com.jumi.microservice.dto.jd.query.JFGoodsReqRequest;
import com.jumi.microservice.dto.jd.query.JdQueryListResponse;
import com.jumi.microservice.jwt.annon.IgnoreUrlsAnnon;
import com.jumi.microservice.service.jd.service.JdServiceImpl;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/api/jd")
@Api(tags = {"C端-京东"})
public class JdController {
    @Autowired
    JdServiceImpl jdService;

    @ApiOperation("/京粉精选商品查询接口")
    @GetMapping("/query")
    @IgnoreUrlsAnnon("/query")
    public TableDataInfo<JdQueryListResponse> query(JFGoodsReqRequest JFGoodsReqRequest) throws Exception {
        return jdService.query(JFGoodsReqRequest);
    }
    @ApiOperation("/商品详情查询接口")
    @GetMapping("/details")
    @IgnoreUrlsAnnon("/details")
    public ResponseResult<JdBigFieldGoodsResponse> details(JdGoodsDetailsRequest request) throws Exception {
        return jdService.details(request);
    }
    @ApiOperation("/关键词商品查询接口")
    @GetMapping("/keyWord")
    @IgnoreUrlsAnnon("/keyWord")
    public TableDataInfo<JdQueryListResponse> keyWord(JdKeywordQueryRequest request) throws Exception {
        return jdService.keyWord(request);
    }
    @ApiOperation("/商品类目查询接口")
    @GetMapping("/category")
    @IgnoreUrlsAnnon("/category")
    public ResponseResult<List<JdCategoryResponse>> category(JdCategoryRequest request) throws Exception {
        return jdService.category(request);
    }
    @ApiOperation("/网站/APP获取推广链接接口")
    @GetMapping("/promote")
    @IgnoreUrlsAnnon("/promote")
    public ResponseResult<JdPromoteResponse> promote(JdPromoteRequest request) throws Exception {
        return jdService.promote(request);
    }
}
